//
//  SetView.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2024/12/26.
//

import SwiftUI
import Kingfisher
import PhotosUI

struct VipItemView: View {
    @StateObject var viewModel = VipViewModel()
    @State var bean: VipConfigBean
    let isSelected: Bool
    var body: some View {
        HStack{
            VStack(alignment: .leading) {
                Text(bean.title ?? "")
                    .foregroundStyle(.bgItemContent)
                    .font(.system(size: 14))
                Text(bean.subtitle ?? "")
                    .foregroundStyle(themeManager.themeColor)
                    .font(.system(size: 10))
            }
            Spacer()
            if !(bean.hidePrice ?? false) && (bean.price ?? 0) > 0 {
                Text("原价\(formatPrice(bean.price ?? 0))元")
                    .foregroundStyle(.bgNormalText4)
                    .font(.system(size: 10))
                    .strikethrough()
            }
            Text("¥\(formatPrice(bean.vipPrice ?? 0))")
                .foregroundStyle(.bgDel)
                .font(.system(size: 14))
            if isSelected {
                Image(.appIcCheckboxSelect)
                    .resizable()
                    .renderingMode(.template)
                    .foregroundColor(themeManager.themeColor)
                    .frame(width: 20, height: 20)
            } else {
                Image(.appIcCheckbox)
                    .resizable()
                    .frame(width: 20, height: 20)
            }
        }
    }
}

//#Preview {
//    SetView()
//}


//定义预览提供者
//struct VipItemView_Previews: PreviewProvider {
//    static var previews: some View {
//        //使用预览共享配置
//        configurePreviewEnvironment(for: VipItemView(bean: VipConfigBean()))
//    }
//}
